UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pcGCFxV499UVtOP//KSIGYfdK+PBFywtuWMHQFZJCSA=' 
WHERE 
  key_id = 'a50c6bc87b1c31025193e2200d4187290bbb656696408a7104ea67780a4b8457' 
  AND (
    token = 'pcGCFxV499UVtOP//KSIGYfdK+PBFywtuWMHQFZJCSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032