UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mY67G1OH9B8GgzJ2djR8ArjgstZXDXq36a6WqOw4z4k='
WHERE
key_id = 'b929e4d3f65fe1eff7ddf2799e4a92f225502d5859d0825c05be075483acf440'
AND (
token = 'mY67G1OH9B8GgzJ2djR8ArjgstZXDXq36a6WqOw4z4k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)