UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g0n3Q7GywG1G39ot97I2FHElLN/VPHuBUyL8IPV289Y='
WHERE
key_id = 'e9d632230df34868678f836eb356d341b66438dbfb18d83f2429e629c146b841'
AND (
token = 'g0n3Q7GywG1G39ot97I2FHElLN/VPHuBUyL8IPV289Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)