UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UaRS+Ch5egnYqz9uOAsgAt/J0w76wijPncgi0BZu7i8=' 
WHERE 
  key_id = '785c1c9941515cce32da51971b6a1fae76522e903b122d168dc0443b9b28222a' 
  AND (
    token = 'UaRS+Ch5egnYqz9uOAsgAt/J0w76wijPncgi0BZu7i8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028