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

Query time 0.00045