UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M8stjGhwLJBtEm9wmsoYybj+EWPyoWmx1Je7gzWj3Rk='
WHERE
key_id = '1c56358a79394e63f9d4527b7e46eae27d18de2797a46b5761b1369494579071'
AND (
token = 'M8stjGhwLJBtEm9wmsoYybj+EWPyoWmx1Je7gzWj3Rk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)