UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YcHWTxF8BVOdQLs5VAt9FBDOIUoZNwfinZFL/XAVr3o='
WHERE
key_id = '3051ee09e7632f8e830ac2ad44c219f7ca100e5e1367751b4e5d654590638f33'
AND (
token = 'YcHWTxF8BVOdQLs5VAt9FBDOIUoZNwfinZFL/XAVr3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)