UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jx43qYskkk8cJK1DIBvXM6TE0dxF5Q7JQASzWM1ReZA=' 
WHERE 
  key_id = '0985fd8b927c3738743280004acb1a7f036acfe8778e5cb5761833ac90de6339' 
  AND (
    token = 'jx43qYskkk8cJK1DIBvXM6TE0dxF5Q7JQASzWM1ReZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051