UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K5cI+XucXgBrKKNRolDFG5PqflNA59IlYC33X9SYEm8='
WHERE
key_id = '4347f810f4b06d12829e8e70ba5765f555e848ed4d5fd1dfc443e2a784786aad'
AND (
token = 'K5cI+XucXgBrKKNRolDFG5PqflNA59IlYC33X9SYEm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)