UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lJY9c6OqV7aSaNhx4rRK6t9/zBklI3BKJLmN+NWUBCs='
WHERE
key_id = 'b7c98b83dfc0a0307b807f4168552fac34c36ecb64a5a97d9dd306d2fc9bf92c'
AND (
token = 'lJY9c6OqV7aSaNhx4rRK6t9/zBklI3BKJLmN+NWUBCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)