UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSEn2s5h/X6rfK5jTw6UXusmRPwMq6SCR9VVX4fiMJA=' 
WHERE 
  key_id = '04a0075ba1a050a6d16ee4334c91d0516e9e7e4bbe6dd29e355e623492ae3b0f' 
  AND (
    token = 'CSEn2s5h/X6rfK5jTw6UXusmRPwMq6SCR9VVX4fiMJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020