UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a8CoUIiIQ8fHRZwGARfwULNKweCPDtGCLRzdVHwdQvQ='
WHERE
key_id = 'aeffe5547d4c6bafc17112c3e592f77b180d4d84c0cba1bfba6ad2e10d9b3fbf'
AND (
token = 'a8CoUIiIQ8fHRZwGARfwULNKweCPDtGCLRzdVHwdQvQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)