UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cXtpHzDN0Zin4apR36lkgapPvyUyU2Jn6Ju4Zm0jry4='
WHERE
key_id = '168220c1d737b80501c00d9bbe6ba5f04262b453f0996d955b725c082e87928b'
AND (
token = 'cXtpHzDN0Zin4apR36lkgapPvyUyU2Jn6Ju4Zm0jry4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)