UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gSxjTpz2RLrzM2TDhFzwzeHz3kcJTMl1n+CjtiFsaUc='
WHERE
key_id = 'b4d3ee13e4477cb3e0aa58cec86bd6b00b6e70151c9df43dd46c8419e379b40d'
AND (
token = 'gSxjTpz2RLrzM2TDhFzwzeHz3kcJTMl1n+CjtiFsaUc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)