UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jlmHQoTn701aC1JcyI+oCvfBNrmyvAKbwE4NjZiNcqs=' 
WHERE 
  key_id = '257a3587e56f2c0b5109903cfcef373cc998775970722f2b7d8ae2459c52c0a7' 
  AND (
    token = 'jlmHQoTn701aC1JcyI+oCvfBNrmyvAKbwE4NjZiNcqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027