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

Query time 0.00030