UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8sGPKLy90avLboxbdLyWsbndD2SZZPV/oPtZtJ5NIe8='
WHERE
key_id = 'a0ce0a9c3cbadf8b441511390e3956f9cc5f5bf14f91c13d702ed8e2d784adc7'
AND (
token = '8sGPKLy90avLboxbdLyWsbndD2SZZPV/oPtZtJ5NIe8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)