UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rzAMDq/18Y7a7iNM0lpTxA6VGJepU+ttYjzT6xcxZS0='
WHERE
key_id = 'd0171ec8c135de85565cd7cc072142eb614362bc51e2dd4b7ac304d5e13c1fae'
AND (
token = 'rzAMDq/18Y7a7iNM0lpTxA6VGJepU+ttYjzT6xcxZS0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)