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

Query time 0.00031