UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wdbyKA1+PlPew18PR+76N93Z7oEe398AD3KN4XpDJb8=' 
WHERE 
  key_id = '8d3bcf4b59e35c19c2d7c98d00f4f2ba1c9af058dcfce9f2a364fd458f7520f6' 
  AND (
    token = 'wdbyKA1+PlPew18PR+76N93Z7oEe398AD3KN4XpDJb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017