UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sjm9YG3B4hrPkIU4I4mpM7EAyoN0ojyetDr2bb87vWs='
WHERE
key_id = '6739462a271403a8853b9d1153a6de957bda7d561fb57d9a76e671d334e5c9a2'
AND (
token = 'sjm9YG3B4hrPkIU4I4mpM7EAyoN0ojyetDr2bb87vWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)