UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9PNZ9d8hnxbso3vkqZNxWwpuely2UCjdylcpJF5AJ4M='
WHERE
key_id = '3e0c288f34b29353c05f41da0dc1695b52e2dd7bae612f827236d43105b07140'
AND (
token = '9PNZ9d8hnxbso3vkqZNxWwpuely2UCjdylcpJF5AJ4M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)