UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '34epReaVAQRVfzKJgXUMKlMyD3GxCKzV3d5NAH2DQws='
WHERE
key_id = 'a74fe0f224be4a09950b843487e2c81ea8c7f1972e2d327415596380f3626ef1'
AND (
token = '34epReaVAQRVfzKJgXUMKlMyD3GxCKzV3d5NAH2DQws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)