UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7uYYhAoiDJ3bsE+6bEYqrTDomgApDeuDLbsRjaJsre8='
WHERE
key_id = 'a8d0a78b5ca8302d936da25a2bd3e2abb6340a5ad01899cbe1c051dca7756301'
AND (
token = '7uYYhAoiDJ3bsE+6bEYqrTDomgApDeuDLbsRjaJsre8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)