UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5AF504Xcb5n2hx2MK3kLHY2RflpfsW9dhtnJNxSYlRM='
WHERE
key_id = 'fe14b437c46475d8b12c6424043f2542afbc195e55189864e39c17a66d530274'
AND (
token = '5AF504Xcb5n2hx2MK3kLHY2RflpfsW9dhtnJNxSYlRM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)