UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oiikVvNI1B1O6btCL+8XJO7BFQUp8jq6l995kNEiHDo=' 
WHERE 
  key_id = '5e83638b1ac5a0a469917e1715287adeaffc78a7b995a71d34daa840ba35578a' 
  AND (
    token = 'oiikVvNI1B1O6btCL+8XJO7BFQUp8jq6l995kNEiHDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027