UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '16pZWdgdwuyyA4PsyULjH+jRPZwsYmQ7ZJPIHnwP5Jc='
WHERE
key_id = 'b766a095b6816c2fbb41bf6e34e5125da1bcf299e1d5a8e39a83ba1185aeb747'
AND (
token = '16pZWdgdwuyyA4PsyULjH+jRPZwsYmQ7ZJPIHnwP5Jc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)