UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd3k4gmStSYOQ7vGanH4G2ZV1DLpcNxt3CisIXCOe528=' 
WHERE 
  key_id = '57fef42a36e740db6a3e0103a411f4500efda76a2001e8780004edf3f42a81d0' 
  AND (
    token = 'd3k4gmStSYOQ7vGanH4G2ZV1DLpcNxt3CisIXCOe528=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043