UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DS4Yc0bjQLzU63g4AjcgwpWvt/8KgBBEVkdWjFU04rg='
WHERE
key_id = '51c8180c043f8afbf080867273f765c665728c5f378daabaf9286514c5fb5f37'
AND (
token = 'DS4Yc0bjQLzU63g4AjcgwpWvt/8KgBBEVkdWjFU04rg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)