UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bhek62UNezOZt8x7fn5prbA5rW10MN6gXEKeshdvo6k=' 
WHERE 
  key_id = 'f540087403a50df0cd5eedc33fd4a7d3df526b4dfeb10993844d82b1faf4af8b' 
  AND (
    token = 'Bhek62UNezOZt8x7fn5prbA5rW10MN6gXEKeshdvo6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042