UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BXQB0N2rRBGdnO3O+p2aW21wcqp8nBfjpRmlcujQOnY=' 
WHERE 
  key_id = '187dda2e9159f6edeaffeca940a353d8e00aed4ca347c759f0a652e1b70fcd26' 
  AND (
    token = 'BXQB0N2rRBGdnO3O+p2aW21wcqp8nBfjpRmlcujQOnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036