UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pZ2IHuWMIGIg9I34X791R+uxwy+evIe852FOt84eiTA='
WHERE
key_id = '1ab3e51da170e506dd66d16b6f56a3f5e1d092e23409d43083927f1318cd7e8c'
AND (
token = 'pZ2IHuWMIGIg9I34X791R+uxwy+evIe852FOt84eiTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)