UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AaG9a1HwptsQ8W2H+5dgnyEzpS3FI8zVFGxmcckvX4s=' 
WHERE 
  key_id = '312f31f398e04f2ebfc34d12504f72af3cad5c375c8190b58bb8c677dc270c49' 
  AND (
    token = 'AaG9a1HwptsQ8W2H+5dgnyEzpS3FI8zVFGxmcckvX4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056