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