UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c7hYEjZB5/2MsOS5vOGWMUwOdvs+SEDo+d6Zp7yLhSM='
WHERE
key_id = 'c813f109ea2ed9ad420ef2b7c7bac8ed22d6305ac68993357b623682d3a7a25b'
AND (
token = 'c7hYEjZB5/2MsOS5vOGWMUwOdvs+SEDo+d6Zp7yLhSM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)