UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vzD0iU2jNBJPIDiichTXhyBRDoS+CmP1wf1EaAqtDas=' 
WHERE 
  key_id = '135d266b7a7ee1169a21c692129976f236691a210c524de132a66fd6ed9dd10b' 
  AND (
    token = 'vzD0iU2jNBJPIDiichTXhyBRDoS+CmP1wf1EaAqtDas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047